﻿namespace CodingExercises._1_25;

public class ContainsNegative
{
    /// <summary>
    /// Check if a collection contains any negative numbers
    /// </summary>
    /// <param name="numbers"></param>
    /// <returns></returns>
    public static bool Test1(IEnumerable<int> numbers)
    {
        foreach (var number in numbers)
        {
            if (number < 0)
                return true;
        }

        return false;
    }

    public static bool Test2(IEnumerable<int> numbers)
    {
        return numbers.Any(number => number < 0);
    }
}